var Koa=require("koa");
var router=require("koa-router")();
var views=require("koa-views");
var nunjucks=require("nunjucks");
var parser=require("koa-parser");
var app=new Koa();
app.use(parser());
app.listen("1000",()=>{
    console.log("成功");
})
app.use(views(__dirname+"/html",{
    map:{html:'nunjucks'}
}));
router.get("/",async ctx=>{
    await ctx.render("index",{
        title:"首页",
        content:"内容"
    })
})
router.get("/130",async ctx=>{
    var text=ctx.query.text;
    var password=ctx.query.password;
    await ctx.render("index",{
        title:"用户名"+text,
        content:"密码"+password
    })
})
router.post("/140",async ctx=>{
    var text=ctx.request.body.text;
    var password=ctx.request.body.password;
    await ctx.render("index",{
        title:"用户名"+text,
        content:"密码"+password
    })
})
app.use(router.routes());


